from product.reviews import reviews
from pymongo import MongoClient
from product.mongodb import mongodb
import threading

conn = MongoClient(mongodb.ip, 27017)
db = conn.pinduoduo
goodsDb = db.goods
data = goodsDb.find()
reviews = reviews.reviews()
for key in data:
    for index in range(1, 5):
        t1 = threading.Thread(target=reviews.getReviewsData, args=(key['goods_id'], 10, index,))
        t1.setDaemon(True)
        t1.start()
    t1.join()